package com.huadao.cart_ccs.greendao.entity;

import android.support.annotation.NonNull;

import com.huadao.cart_ccs.common.ExperimentStageManager;
import com.huadao.cart_ccs.common.ProjectManager;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;

import java.io.Serializable;
import java.util.Date;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Keep;

@Entity
public class LiquidLoopPlan implements Serializable,Comparable<LiquidLoopPlan>{
    private static final long serialVersionUID = -5551299546829640967L;
    @Id
    private Long id;
    private long projectId;
    private long stageId;

    private String name;
    private Date startTime;
    private int amount;
    private int fluidIntake_speed;
    private int dischard_speed;

    private boolean isFinished;
    //计划之间最少间隔时间,秒
    public static final int minGapTime=5;

    @Generated(hash = 1985374540)
    public LiquidLoopPlan(Long id, long projectId, long stageId, String name,
            Date startTime, int amount, int fluidIntake_speed, int dischard_speed,
            boolean isFinished) {
        this.id = id;
        this.projectId = projectId;
        this.stageId = stageId;
        this.name = name;
        this.startTime = startTime;
        this.amount = amount;
        this.fluidIntake_speed = fluidIntake_speed;
        this.dischard_speed = dischard_speed;
        this.isFinished = isFinished;
    }
    @Keep
    public LiquidLoopPlan() {
        projectId=ProjectManager.getInstance().getProjectId();
        stageId=ExperimentStageManager.getInstance().getStageId();
    }

    public Long getId() {
        return this.id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public long getProjectId() {
        return this.projectId;
    }
    public void setProjectId(long projectId) {
        this.projectId = projectId;
    }
    public long getStageId() {
        return this.stageId;
    }
    public void setStageId(long stageId) {
        this.stageId = stageId;
    }
    public Date getStartTime() {
        return this.startTime;
    }
    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }
    public int getAmount() {
        return this.amount;
    }
    public void setAmount(int amount) {
        this.amount = amount;
    }
    public int getFluidIntake_speed() {
        return this.fluidIntake_speed;
    }
    public void setFluidIntake_speed(int fluidIntake_speed) {
        this.fluidIntake_speed = fluidIntake_speed;
    }
    public String getName() {
        return this.name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getDischard_speed() {
        return this.dischard_speed;
    }
    public void setDischard_speed(int dischard_speed) {
        this.dischard_speed = dischard_speed;
    }

    @Override
    public int compareTo(@NonNull LiquidLoopPlan o) {
        if(this.getStartTime().before(o.getStartTime())){
            return -1;
        }else if(this.getStartTime().after(o.getStartTime())){
            return 1;
        }else {
            return 0;
        }
    }
    public boolean getIsFinished() {
        return this.isFinished;
    }
    public void setIsFinished(boolean isFinished) {
        this.isFinished = isFinished;
    }
}
